Barcode Xpress for Node.js detects all barcodes in an image and gives you complete details about them.
Barcodes supported for recognition are listed in the Supported Barcode Types.
Once the barcode type has been determined, use the following method and parameters to recognize the barcode.
JavaScript |
Copy Code
|
---|---|
const bx = require("barcode-js"); const filePath = "filePath/fileName.bmp"; const params = { type: bx.BarcodeType.CODE39 }; const analyzeBarcodes = async (filePath, params) => { try { // Find the barcodes in the document. const results = await bx.analyze(filePath, params); // We have the results, process them. console.log(JSON.stringify(results, ["type", "value", "confidence"], 2)); } catch(err) { console.error(`There was an error processing this image\n${err}`); } } analyzeBarcodes(filePath, params); |